<!--
 * @Author: your name
 * @Date: 2022-04-09 14:53:49
 * @LastEditTime: 2022-04-09 15:01:12
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\面试题字符串反转220409.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字符串反转封装</title>
</head>

<body>
  <script>
    function revergeyao(str) {
      var strrve = '';
        for (var i = str.length - 1; i >= 0; i--) {
          //返回指定索引的值
          strrve += str.charAt(i)
        }
      return strrve
    }
    var geyao = "geyao"
    console.log(revergeyao(geyao))//oayge
  </script>
</body>

</html>